<template>
	<view class=" count">
		<div class="bgQie">
			<image :src="obj.book.cover" class="bgQieImg" mode="aspectFit"></image>

		</div>
		<view class="botBox p-t-40 p-b-20">
			<view class="titName m-b-30">
				{{obj.book.name}}
			</view>
			<view class="author m-b-10">
				书籍作者：{{obj.book.author}}
			</view>
			<view class="author m-b-10">
				书籍出版社：{{obj.book.press}}
			</view>
			<view class="author m-b-10">
				书籍所属丛书：{{obj.book.series}}
			</view>
			<view class="author m-b-10">
				ISBN码：{{obj.book.isbn}}
			</view>
			<view class="author m-b-10">
				书籍编号：{{obj.book_no}}
			</view>

		</view>
		<view @click="comitCode" class="botBtn">
			确认借阅
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				code: '',
				obj: {}
			}
		},
		onLoad(options) {
			this.code = options.code
			this.initObj()
		},
		methods: {
			async initObj() {
				let n = await this.$api.BorrowsConfirm({
					book_no: this.code
				})
				this.obj = n.data
			},
			// 确认借阅
			async comitCode() {
				let n = await this.$api.BorrowsJie({
					book_no: this.code
				})
				if (n.status) {
					this.$msg(n.message)
					setTimeout(() => {
						uni.navigateTo({
							url: '/pageA/BorrowCode?code=' + n.data.content
						})
					}, 1000)
				} else {
					this.$msg(n.message)
				}
			}
		},
		onShareAppMessage() {

		},
		onShareTimeline() {

		},
	}
</script>

<style lang="scss" scoped>
	.botBtn {
		position: fixed;
		bottom: 200rpx;
		left: 5%;
		width: 90%;
		height: 88rpx;
		line-height: 85rpx;
		background: #009d85;
		border-radius: 44rpx;
		font-size: 30rpx;
		font-family: PingFang SC, PingFang SC-Bold;
		font-weight: 700;
		text-align: center;
		color: #ffffff;
	}

	.titName {
		font-size: 32rpx;
		font-family: PingFang SC, PingFang SC-Bold;
		font-weight: 700;
		text-align: left;
		color: #333333;
	}

	.botBox {
		width: 90%;
		margin: 0 auto;

		.author {
			font-size: 28rpx;
			font-family: PingFang SC, PingFang SC-Regular;
			font-weight: 400;
			text-align: left;
			color: #666666;
		}
	}

	.bgQie {
		width: 100%;
		height: 514rpx;
		overflow: hidden;

		.bgQieImg {
			width: 100%;
			height: 100%;
			object-fit: cover;
		}
	}

	.count {
		height: 100vh;
		width: 100%;
		background-color: #fff;
	}
</style>